package com.first.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.first.common.pojo.TbArticle;
import com.first.common.pojo.TbBottomArticle;
import com.first.common.vo.Result;
import com.first.system.dao.BottomArticleDao;
import com.first.system.dao.BottomDao;
import com.first.system.service.BottomArticleService;
import com.first.system.vo.BottomArticleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: first-project
 * @description:
 * @author: 闫锦超
 * @create: 2023-05-30 16:29
 **/
@Service
public class BottomArticleServiceImpl implements BottomArticleService {

    @Autowired
    private BottomArticleDao bottomArticleDao;
    @Override
    public Result getArticleByNavId(BottomArticleVo bottomArticleVo) {
        QueryWrapper<TbArticle> wrapper = new QueryWrapper<>();
        wrapper.eq("nav_id",bottomArticleVo.getNavId());
        TbArticle tbArticle = bottomArticleDao.selectOne(wrapper);
        return Result.success(tbArticle);
    }

    @Override
    public Result updateArticleByNavId(TbArticle tbArticle) {
        int i = bottomArticleDao.updateById(tbArticle);
        if(i!=0){
            return Result.success();
        }
        return null;
    }
}
